package com.fita.admin.service.data.impl;

import com.demo2do.core.persistence.GenericDaoSupport;
import com.demo2do.core.persistence.annotation.Dao;
import com.fita.admin.dao.SetDao;
import com.fita.admin.service.DataServiceImpl;
import com.fita.admin.service.data.SetService;
import com.fita.entity.set.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 
 * @author sjh
 *
 */
@Service("setService")
public class SetServiceImpl extends DataServiceImpl<Set> implements SetService{
	
	@Dao
	private SetDao setDao;
	
	@Autowired
	private GenericDaoSupport genericDaoSupport;
	
	/*
	 * (non-Javadoc)
	 * @see com.fita.admin.service.data.SetService#load(java.lang.String)
	 */
	public Set load(String code) {
		
		return setDao.load(code);
	}
	
	/* (non-Javadoc)
	 * @see com.fita.admin.service.data.SetService#open(java.lang.Long)
	 */
	public void open(Long setId) {
		
		Set set = genericDaoSupport.load(Set.class, setId);
		
		set.open();
		
		genericDaoSupport.update(set);
	}
	
	/* (non-Javadoc)
	 * @see com.fita.admin.service.data.SetService#close(java.lang.Long)
	 */
	public void close(Long setId) {
		
		Set set = genericDaoSupport.load(Set.class, setId);
		
		set.close();
		
		genericDaoSupport.update(set);
	}

}
